package com.woniuxy.springboot02javaconfig;

import com.woniuxy.springboot02javaconfig.pojo.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

@SpringBootApplication
/**
 * 注解要被springboot所扫描到，默认情况下必须放在和启动类同包下，或者子包下，如果不放有两种办法解决
 * 第1种方式:@ComponentScan,就相当于XML配置中<context:component-scan base-package="xx">
 *     @ComponentScan("config")
 * 第2种方式:@Import,相当于XML配置种<import resource="xx"></import>
 */
@Import({config.JavaConfig1.class,config.JavaConfig2.class})
public class Springboot02JavaconfigApplication {
	public static void main(String[] args) {
		SpringApplication.run(Springboot02JavaconfigApplication.class, args);
	}

	@Bean
	public User getUserBean7(){
		return new User("杨白劳");
	}
}
